<template>
  <div>
    <div class="content">
      <router-view></router-view>
    </div>
    <van-tabbar
      fixed
      route
      active-color="#29A1F7"
      inactive-color="#000"
      @change="onChange"
    >
      <van-tabbar-item replace to="/home">
        <span>首页</span>
        <template #icon="props">
          <img :src="props.active ? icon.active : icon.inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item replace icon="search" to="/content"
        >内容</van-tabbar-item
      >
      <van-tabbar-item replace to="/person" icon="setting-o"
        >个人</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>
<script>
export default {
  name: "Test",
  data() {
    return {
      icon: {
        active: "https://img01.yzcdn.cn/vant/user-active.png",
        inactive: "https://img01.yzcdn.cn/vant/user-inactive.png",
      },
    };
  },
  methods: {
    onChange(index) {
      this.$toast(index);
      // this.$notify({
      //   type: "primary",
      //   message: index,
      //   // color: "#ad0000",
      //   // background: "#ffe1e1",
      //   // duration: 1000,
      // });
    },
  },
};
</script>
<style lang="less" scoped>
.content {
  // 去除顶部导航和底部导航的高度
  height: calc(100vh - 50px);
}
</style>